package com.platform.module.common.enums.app;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

public enum AgentEnum {

    // 300000 ~ 400000
    IN_WINNER_H5("329981", "in_winner_h5"),
    BET_WIN_H5("329982", "bet_win_h5"),
    SAG_WINNER_H5("329983", "sag_winner_h5"),


    ;

    private static final Logger log = LoggerFactory.getLogger(AgentEnum.class);
    private final String channel;
    private final String agent;

    AgentEnum(String channel, String agent) {
        this.channel = channel;
        this.agent = agent;
    }

    public static AgentEnum getAgentEnumByChannel(String channel) {
        AgentEnum[] var1 = values();
        int var2 = var1.length;
        return Arrays.stream(var1).filter(agentEnum -> channel.equals(agentEnum.channel)).findFirst().orElse(null);
    }


    // 如果渠道为空或者是IN_WINNER_H5渠道，返回true
    public static boolean isH5(String channel) {
        return StringUtils.isBlank(channel)
                || IN_WINNER_H5.getChannel().equals(channel);
    }

    public static boolean isGoogleApk(String channel) {
        return false;
    }

    // 如果渠道为空或者是IN_WINNER_H5渠道，返回true
    public static boolean isInviteApk(String channel) {
        boolean flag = false;
        if (StringUtils.isBlank(channel)) {
            return false;
        }
        if (IN_WINNER_H5.getChannel().equals(channel)) {
            flag = true;
        }
        return flag;
    }


    public static boolean isBwH5Source(String channel) {
        boolean flag = false;
        if (StringUtils.isBlank(channel)) {
            return false;
        }
        return flag;
    }

    public String getChannel() {
        return this.channel;
    }

    public String getAgent() {
        return this.agent;
    }
}
